<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>菜单管理</title>
    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.css}" rel="stylesheet">
    <link th:href="@{/css/index.css}" rel="stylesheet">
    <link th:href="@{/css/config.css}" rel="stylesheet">
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet">
    <link th:href="@{/css/jquery.pagination.css}" rel="stylesheet">

</head>

<body>
<!-- nav导航 -->
<div th:replace="common/bar::#header"></div>
<!-- 页面主体 -->
<div class="dh mainbox">
    <!-- 左边菜单 -->
    <div th:replace="common/bar::#menu"></div>
    <!-- 右边主显示部分 -->
    <div class="main-rightbox">
        <div class="mainrightbox">
            <!-- 路径导航 -->
            <ol class="breadcrumb">
                <li><a th:href="@{/}">首页</a></li>
                <li class="active">基础管理</li>
                <li class="active">菜单管理</li>
            </ol>
            <!-- 显示表格 -->
            <div class="main_box">
                <!-- 顶部搜索添加框 -->
                <div class="row">
                    <!-- 搜索框 -->
                    <div class="col-lg-2 col-md-4">
                        <div class="input-group">
                            <input type="text" class="form-control" th:value="${movieName}" placeholder="Search for..."
                                   id="search">
                            <span class="input-group-btn">
                                  <button class="btn btn-default" type="button" onclick="movieSearch()">搜索</button>
                            </span>
                        </div>
                    </div>
                    <div class="col-li-2 col-md-4">
                        <button type="button" class="btn btn-primary adduser" onclick="addfun()">添加</button>
                    </div>
                </div>
                <!-- 表格显示区域 -->
                <div class="maintab">
                    <table class="table table-striped table-bordered table-hover" id="sample_1">
                        <thead>
                        <tr>
                            <th>Id</th>
                            <th class="">行政区</th>
                            <th class="">品牌</th>
                            <th class="">影院名</th>
                            <th class="">地址</th>
                            <th class="">标准价格</th>
                            <th class="">电话</th>
                            <th class="">服务</th>
                            <th class="">影院图片</th>
                            <th class="">创建日期</th>
                            <th class="">操作</th>


                        </tr>
                        </thead>

                        <tbody th:if="${page.getRecords()!=null}">
                        <tr class="odd gradeX" th:each="movieThreatre:${page.getRecords()}">
                            <td th:text="${movieThreatre.getId()+''}">1000</td>
                            <td th:text="${movieThreatre.administrativeRegionName}">user-0</td>
                            <td th:text="${movieThreatre.brandName}">123456789@qq.col-md-1</td>
                            <td th:text="${movieThreatre.name}">user-0</td>
                            <td th:text="${movieThreatre.address}">女</td>
                            <td th:text="${movieThreatre.price}">在线</td>
                            <td th:text="${movieThreatre.phone}">在线</td>
                            <td>
                                <p style="font-size: 10px" th:each="server:${movieThreatre.movieTheatreServerVos}"
                                      th:text="${server.label+':'+server.server}"></p>
                            </td>
                            <td><img th:src="${movieThreatre.previewUrl}" style="width: 100px;height: 100px"></td>
                            <td th:text="${#dates.format(movieThreatre.createDate,'yyyy-MM-dd HH:mm:ss')}">在线</td>
                            <td>
                                <span class="label label-success cp editmsg" onclick="editfun()">编辑</span>
                                <span class="label label-success cp" style="background:orange" th:onclick="filmSchedule([[${movieThreatre.getId()+''}]])">排片</span>
                                <span class="label label-success cp deletelist deletebgc"
                                      th:if="${movieThreatre.state==0}"
                                      th:onclick="disable([[${movieThreatre.getId()+''}]])">禁用</span>
                                <span class="label label-success cp deletelist deletebgc"
                                      th:if="${movieThreatre.state==1}"
                                      th:onclick="enable([[${movieThreatre.getId()+''}]])">启用</span>

                            </td>
                        </tr>
                        </tbody>

                    </table>
                </div>
                <!-- 分页 -->
                <div class="text-center">
                    <!--<div id="pagination3" th:if="${page.getRecords()!=null}" class="page fl"></div>-->
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
<!-- 引入公共js文件 -->
<script th:src="@{/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/js/jquery.slimscroll.min.js}"></script>
<script th:src="@{/js/bootstrap.js}"></script>
<script th:src="@{/js/jquery.pagination.min.js}"></script>

<script>
    /**
     *  此方法为切换左边菜单的js文件
     */
    $(".list_dt").on("click", function () {
        $('.list_dd').stop();
        $(this).siblings("dt").removeAttr("id");
        if ($(this).attr("id") == "open") {
            $(this).removeAttr("id").siblings("dd").slideUp();
        } else {
            $(this).attr("id", "open").next().slideDown().siblings("dd").slideUp();
        }
    });

    /**
     * 退出登录
     */
    function logout() {
        window.location.href = "login.html";
    };
    /**
     * 此方法为分页插件提供方法
     * 分页功能
     * 参考文档  http://www.jq22.com/jquery-info15113
     */
    $(function () {


        $("#getPage").on("click", function () {
            var info = $("#pagination3").pagination("getPage");
            alert("当前页数：" + info.current + ",总页数：" + info.total);
        });

        $("#setPage").on("click", function () {
            $("#pagination3").pagination("setPage", 1, 10);
        });
    });

    /**
     * 页面挂载数据方法
     */


    function addfun() {
        window.location.href = "/movie/theatre/movieTheatreAddOrEditor";
    }

    function editfun() {
        window.location.href = "/movieAddOrEditor.html";
    }

    //搜索事件
    function movieSearch() {
    }

    //禁用
    function disable(id) {
        location.href = "/movie/theatre/disable/" + id
    }

    //启用
    function enable(id) {
        location.href = "/movie/theatre/enable/" + id
    }

    //排片
    function filmSchedule(id) {
        location.href="/movie/show/queryMovieShow/"+id;
    }
</script>
</body>

</html>